﻿using Simple.Services.System.MorningCheck;
using Simple.Services.System.MorningCheck.Models;

namespace Simple.WebApi.Controllers.System
{
    /// <summary>
    /// 晨检数据同步
    /// </summary>
    [Route("api/v1/[action]")]
    [ApiController]
    public class StrangerManageController : ControllerBase
    {
        private readonly MorningCheckService _morningCheckService;
        public StrangerManageController(MorningCheckService morningCheckService)
        {
            _morningCheckService = morningCheckService;
        }

        /// <summary>
        /// 晨检回调(陌生人模式)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<DataSynchronismResultModel> Stranger([FromBody] DataSynchronismModel model)
        {
            var result = await _morningCheckService.DataSynchronismAsync(model);
            if (result > 0)
                return new DataSynchronismResultModel
                {
                    Msg = "同步成功",
                    Result = 0
                };

            return new DataSynchronismResultModel();
        }
    }
}
